package com.example.demo.mapper;

import com.example.demo.model.Material;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * Created by 86151 on 2018/12/24.
 */
@Mapper
public interface SpringBootMapper {
    @Select("select * from material")
    List<Material> queryAll();

//    @Update("update material set name = #{name}")
//    int updateMaterial(Material material);
    /*@Delete("delete from  material where name = #{name}")
    int deleteMaterial(Material material);*/
    //@Insert("insert into Material (id,materialCode,materialName,status,materialDesc) " +
    //        "values (#{id},#{materialCode},#{materialName},#{status},#{materialDesc})")
    //int addMaterial(Material material);
    //注解版批量查询
    @SelectProvider(type = DynamicJoin.class, method = "zhuJieBatchQueryAllByIds")
    List<Material> zhuJieBatchQueryAllByIds(@Param("list") List<Integer> ids);

    //批量查询
    List<Material> batchQueryAllByIds(List<Integer> ids);
    //批量新增
    int batchAddMaterial(@Param("materialList") List<Material> materialList);
    //批量修改
    int batchUpdateMaterial(@Param("materialList") List<Material> materialList);
    //批量删除

//新增备件
    @Insert("insert into Material (id,materialCode,materialName,status,materialDesc) " +
                    "values (#{id},#{materialCode},#{materialName},#{status},#{materialDesc})")
    int addMaterial(Material material);
    @Insert("insert into Material (id,materialCode,materialName,status,materialDesc) " +
                    "valu (#{id},#{materialCode},#{materialName},#{status},#{materialDesc})")
    int addMaterialTest(Material material);
}
